Replace application list view with a Vue ViewModel#402
Conversation
| // It is only synchronized at initial load. | ||
| var model = new models.ApplicationListModel(); | ||
| var app_list_view = new application_list_view.ApplicationListView(model); | ||
| var app_list_view = application_list_view.applicationListView; |
There was a problem hiding this comment.
Also assign the model at this stage.
| We initialize this element with "display: none" to prevent displaying | ||
| "No applications found" and the loading spinner at the same time | ||
| --> | ||
| <li v-show="!loading && model.app_list.length === 0" style="display: none;"> |
There was a problem hiding this comment.
Try to use a v-else.
There was a problem hiding this comment.
There's no gain to use v-if and v-else instead of two v-show in terms of lines of code. And my problem is that it changes the behavior of the dom elements, v-ifwill result in rendering the element only if the statement is true, v-showonly changes the style attribute displayof the element, so I have to change the selenium tests which relies on the style attribute
| --> | ||
| <li v-for="(app, index) in model.app_list" | ||
| v-bind:class="{ active: index === model.selected_index }" | ||
| v-on:click="model.selected_index = index" |
| issues when the javascript is not loaded yet (temporary ?) | ||
| --> | ||
| <li v-for="(app, index) in model.app_list" | ||
| v-bind:class="{ active: index === model.selected_index }" |
There was a problem hiding this comment.
v-bind also has a shorthand. I think it's just :class
| v-bind:src="get_icon_src(app.app_data)"> | ||
|
|
||
| <button class="stop-button" | ||
| v-show="app.status === 'RUNNING' && index_mouse_over === index" |
There was a problem hiding this comment.
Try to do this with simple CSS
| stop_application: function(index) { | ||
| this.stop_application_callback(index); | ||
| }, | ||
| mouse_enter: function(index) { |
| this.index_mouse_over = index; | ||
| } | ||
| }, | ||
| mouse_leave: function() { |
| if (self.model.selected_index === index) { | ||
| self.update_selected(); | ||
| watch: { | ||
| 'model.selected_index': function() { this.selected_app_callback(); } |
There was a problem hiding this comment.
This will eventually go away when the syncronization is performed through the model
| function(val) { // jshint ignore:line | ||
| var widget = configurables[val].view(index); | ||
| fieldset.append(widget); | ||
| // Vue.js adds an __ob__ property, we have to fix it |
There was a problem hiding this comment.
If you replace the properties with a list, it should cause no harm and solve this.
| @@ -1,32 +1,33 @@ | |||
| { | |||
| "name": "simphony-remote-deps", | |||
There was a problem hiding this comment.
Use four spaces for indentation. I checked the preferred style guide, and most of the opinions are for four spaces, like in python, including Crockford. We don't have to save space, minification will do that (if ever, js files are cached anyway)
There was a problem hiding this comment.
Ok, correction. Google uses two. uhm....
There was a problem hiding this comment.
Better, keep four for now, and we'll switch to two after this PR is in
| @@ -1,32 +1,33 @@ | |||
| { | |||
| "name": "simphony-remote-deps", | |||
There was a problem hiding this comment.
Better, keep four for now, and we'll switch to two after this PR is in
Codecov Report
@@ Coverage Diff @@
## switch_to_vue #402 +/- ##
==============================================
Coverage 95.17% 95.17%
==============================================
Files 94 94
Lines 3996 3996
Branches 256 256
==============================================
Hits 3803 3803
Misses 139 139
Partials 54 54Continue to review full report at Codecov.
|
The gain of the last changes was null and it results in test failing. I prefer to undo those changes instead of changing the tests.
No description provided.